﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CPPProject.Migrations
{
    public partial class addmodel1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CPPContractDetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ContractNum = table.Column<string>(maxLength: 50, nullable: false),
                    CompanyId = table.Column<long>(nullable: false),
                    Qty = table.Column<decimal>(nullable: false),
                    Price = table.Column<decimal>(nullable: false),
                    PartNum = table.Column<string>(maxLength: 50, nullable: false),
                    Name = table.Column<string>(maxLength: 500, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CPPContractDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CPPContractDetail_CPPCompany_CompanyId",
                        column: x => x.CompanyId,
                        principalTable: "CPPCompany",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_CPPContractDetail_CompanyId",
                table: "CPPContractDetail",
                column: "CompanyId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CPPContractDetail");
        }
    }
}
